<template>
  <div class="">
    <NavBar />
    <!-- <el-backtop target="html body"></el-backtop> -->
    <router-view></router-view>
  </div>
</template>

<script>
import NavBar from "./pages/NavBar";
import Cookie from "./untils/Cookie";
export default {
  name: "App",
  data() {
    return {
      activeIndex: "/home",
      activeIndex2: "/home",
    };
  },
  computed: {},
  watch: {},

  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
  },
  created() {
    let token = sessionStorage.getItem("token");
    if (token) {
      //判断是否有token
      // console.log(token);
      this.axios.get("/api/v1/users/info").then((res) => {
        //获取用户信息
        this.$store.commit("initUser", JSON.stringify(res.data));
      });
    } else {
      this.$store.commit("initUser");
    }
  },
  mounted() {},
  components: { NavBar },
};
</script>
<style scoped>
</style>
<style>
body,
html,
#app {
  height: 100%;
}
.contain {
  width: 1200px;
  margin: 0 auto;
}
</style>